<template>
  <div class="page-box">
    <breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
    <div class="app-container">
      <div class="filter-container">
        <el-form :inline="true" class="demo-form-inline" label-position="left" label-width="110px">
          <el-form-item label="商机编码">
            <el-input v-model="search.busiOpportunityNumber" placeholder="请输入商机编码" />
          </el-form-item>
          <el-form-item label="全网商机编号">
            <el-input v-model="search.busiOpportunityCode" placeholder="请输入全网商机编号" />
          </el-form-item>
          <el-form-item v-if="this.search.type !== 'XS_SHANG_JI'" label="全网项目编号">
            <el-input v-model="search.groupProjectCode" placeholder="请输入全网项目编号" />
          </el-form-item>
          <el-form-item v-if="this.search.type !== 'XS_SHANG_JI'" label="项目名称">
            <el-input v-model="search.projectName" placeholder="请输入名称" />
          </el-form-item>
          <el-form-item label="归属地">
            <el-select v-model="search.cityCode" placeholder="请选择" :disabled="disabled">
              <el-option v-for="item, i in options" :key="i" :label="item.label" :value="item.value" />
            </el-select>
          </el-form-item>
          <el-form-item v-if="this.search.type !== 'XS_SHANG_JI'" label="预决策完成时间">
            <el-date-picker v-model="search.time" type="daterange" start-placeholder="开始日期" format="yyyy-MM-dd"
              value-format="yyyy-MM-dd" end-placeholder="结束日期" />
          </el-form-item>

          <el-form-item>
            <el-button type="primary" @click="onSubmit">查询</el-button>
            <el-button @click="reset">重置</el-button>
          </el-form-item>
        </el-form>
      </div>

      <el-table :key="tableKey" v-loading="listLoading" :data="list" border fit style="width: 100%;"
        :height="height + 'px'">
        <el-table-column v-element-table-tooltip label="归属地市" align="center" width="100">
          <template slot-scope="{row}">
            <span>{{ row.cityName }}</span>
          </template>
        </el-table-column>
        <el-table-column v-element-table-tooltip label="归属区县" align="center" width="150">
          <template slot-scope="{row}">
            <span>{{ row.publicCountyCode }}</span>
          </template>
        </el-table-column>
        <el-table-column v-element-table-tooltip label="商机编码" align="center" width="150">
          <template slot-scope="{row}">
            <span>{{ row.busiOpportunityNumber }}</span>
          </template>
        </el-table-column>
        <el-table-column v-element-table-tooltip label="全网商机编号" align="center" width="250">
          <template slot-scope="{row}">
            <span>{{ row.busiOpportunityCode }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="全网项目编码" align="center"
          width="150">
          <template slot-scope="{row}">
            <span>{{ row.groupProjectCode }}</span>
          </template>
        </el-table-column>
        <el-table-column v-element-table-tooltip label="商机名称" align="center"
          :width="this.search.type == 'XS_SHANG_JI' ? auto : 200">
          <template slot-scope="{row}">
            <span>{{ row.busiOpportunityName }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="项目名称" align="center"
          width="200">
          <template slot-scope="{row}">
            <span>{{ row.projectName }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="集团客户名称" align="center"
          width="200">
          <template slot-scope="{row}">
            <span>{{ base64Decode(row.customerName) }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="所属行业" align="center"
          width="200">
          <template slot-scope="{row}">
            <span>{{ projectIndustrycounty[row.industrycounty || '11'] }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="后向合作伙伴名称"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.partnerName }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="是否招投标项目"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.bidFlag == "N" ? '否' : '是' }}</span>
          </template>
        </el-table-column>
        <el-table-column v-element-table-tooltip label="商机创建时间" align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.oppcreatedate }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type == 'XS_SHANG_JI'" v-element-table-tooltip label="1阶1星首次归档时间"
          align="center">
          <template slot-scope="{row}">
            <span>{{ row.sjFirstTime }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type == 'XS_SHANG_JI'" v-element-table-tooltip label="1阶2星首次归档时间"
          align="center">
          <template slot-scope="{row}">
            <span>{{ row.preSaleSupportLaunchTime }}</span>
          </template>
        </el-table-column>
        <el-table-column v-element-table-tooltip label="售前支撑发起时间" align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.preSaleSupportStartTime }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="售前支撑完成时间"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.preSaleSupportFinishTime }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="预决策完成时间"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.preProjectDate }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="中标时间" align="center"
          width="200">
          <template slot-scope="{row}">
            <span>{{ row.winningTime }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="立项完成时间" align="center"
          width="200">
          <template slot-scope="{row}">
            <span>{{ row.projectFinishTime }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="项目首次签约时间"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.proSigningFirstTime }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="项目开工时间" align="center"
          width="200">
          <template slot-scope="{row}">
            <span>{{ row.actStartTime }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="项目实际交付时间"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.actualDeliveryTime }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="合同要求交付时间"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.contractDeliveryTime }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="合同履约开始时间"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.contractBeginTime }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="合同履约结束时间"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.contractEndTime }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="上月计划出账金额含税(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.monthPlanBillAmountHan }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="上月计划出账金额不含税(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.monthPlanBillAmountNone }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="上月实际出账金额含税(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.monthActualBillAmountHan }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="上月实际出账金额不含税(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.monthActualBillAmountNone }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="上月计划支出金额含税(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.monthPlanExpenseAmountHan }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="上月计划支出金额不含税(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.monthPlanExpenseAmountNone }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="上月实际报账金额含税(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.MonthActualReportAmountHan }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="上月实际报账不含税(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.MonthActualReportAmountNone }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="是否预立项超30天未中标"
          align="center" width="180">
          <template slot-scope="{row}">
            <span>{{ row.winFlag == 'Y' ? '是' : '否' }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="是否逾期交付" align="center"
          width="120">
          <template slot-scope="{row}">
            <span>{{ row.jfFlag == 'Y' ? '是' : '否' }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="是否逾期交底" align="center"
          width="120">
          <template slot-scope="{row}">
            <span>{{ row.jdFlag == 'Y' ? '是' : '否' }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="是否逾期签约" align="center"
          width="120">
          <template slot-scope="{row}">
            <span>{{ row.qyFlag == 'Y' ? '是' : '否' }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="前向合同名称" align="center"
          width="200">
          <template slot-scope="{row}">
            <span>{{ row.contractName }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="前向合同编码" align="center"
          width="200">
          <template slot-scope="{row}">
            <span>{{ row.contractCode }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="后向合同名称" align="center"
          width="200">
          <template slot-scope="{row}">
            <span>{{ row.afterContractName }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="后向合同编码" align="center"
          width="200">
          <template slot-scope="{row}">
            <span>{{ row.afterContractCode }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="项目合同总金额含税(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.moneyTax }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="项目合同总金额不含税(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.winBidMoney }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="后向合同签约金额含税(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.afterContractAmount }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="后向合同签约金额不含税(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.afterContractAmountNone }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="IT通服收入含税-概算(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.itServiceRevenueAmount }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="IT通服收入不含税-概算(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.itServiceRevenueAmountNone }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="IT通服收入不含税-预算(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.itservicerevenueamountnoneys }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="CT通服收入含税-概算(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.ctServiceRevenueAmount }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="CT通服收入不含税-概算(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.ctServiceRevenueAmountNone }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="CT通服收入不含税-预算(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.ctservicerevenueamountnoneys }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="非通服收入含税-概算(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.nonServiceRevenueAmount }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="非通服收入不含税-概算(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.nonServiceRevenueAmountNone }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="非通服收入不含税-预算(元)"
          align="center" width="200">
          <template slot-scope="{row}">
            <span>{{ row.nonservicerevenueamountnoneys }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="当前阶段" align="center"
          width="200">
          <template slot-scope="{row}">
            <span>{{ row.currentStage }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="是否已结项" align="center"
          width="100">
          <template slot-scope="{row}">
            <span>{{ row.jxFlag == 'Y' ? '是' : '否' }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="是否续签项目" align="center"
          width="110">
          <template slot-scope="{row}">
            <span>{{ row.xqState == 'Y' ? '是' : '否' }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="项目合同模式" align="center"
          width="150">
          <template slot-scope="{row}">
            <span>{{ projectContract[row.projectContractMode || '10'] }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="项目实施类型" align="center"
          width="150">
          <template slot-scope="{row}">
            <span>{{ projImplementation[row.ProjImplementationType || '10'] }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="项目整体利润率(概算)"
          align="center" width="180">
          <template slot-scope="{row}">
            <span>{{ row.totalProfit || 0 }}%</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="IT部分利润率(概算)"
          align="center" width="180">
          <template slot-scope="{row}">
            <span>{{ row.itProfit || 0 }}%</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="项目整体利润率(预算)"
          align="center" width="180">
          <template slot-scope="{row}">
            <span>{{ row.profitMargin || 0 }}%</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="IT部分利润率(预算)"
          align="center" width="180">
          <template slot-scope="{row}">
            <span>{{ row.itNpv || 0 }}%</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="项目整体利润率(核算)"
          align="center" width="180">
          <template slot-scope="{row}">
            <span>{{ row.profitMarginHe || 0 }}%</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="IT部分利润率(核算)"
          align="center" width="180">
          <template slot-scope="{row}">
            <span>{{ row.itIpr || 0 }}%</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="动态回收期(决算)"
          align="center" width="180">
          <template slot-scope="{row}">
            <span>{{ row.dynamicYear }}</span>
          </template>
        </el-table-column>
        <el-table-column v-if="this.search.type !== 'XS_SHANG_JI'" v-element-table-tooltip label="静态回收期(决算)"
          align="center" width="180">
          <template slot-scope="{row}">
            <span>{{ row.staticYear }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" fixed="right" width="100">
          <template slot-scope="{row}">
            <el-button type="text" @click="goDetail(row)">详情</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total > 0" :total="total" :page.sync="pagination.pageNum" :limit.sync="pagination.pageSize"
        @pagination="getPagination" />
    </div>
  </div>
</template>

<script>
import { getIncomeQuestion } from '@/api/api'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
import Breadcrumb from '@/components/Breadcrumb'
import moment from 'moment'
let query
export default {
  name: 'projectTable',
  components: { Breadcrumb, Pagination },
  data() {
    return {
      disabled: sessionStorage.getItem('orgCode') !== '10008',
      height: 600,
      projectContract: {
        '10': '普通项目',
        '20': '框架订单项目集(非总分框架项目)',
        '30': '框架结算项目集(总分框架项目)',
        '40': '统谈分签项目集',
        '50': '框架子项目',
        '60': '统谈分签子项目'
      },
      projImplementation: {
        '10': '纯建设',
        '20': '纯运维',
        '30': '建设+运维'
      },
      projectIndustrycounty: {
        '1': '医疗',
        '2': '教育',
        '3': '金融',
        '4': '交通',
        '5': '商客',
        '6': '工业能源',
        '7': '融合创新',
        '8': '党政军',
        '9': '互联网',
        '10': '农业文旅',
        '11': '未知'
      },
      tableKey: 0,
      list: null,
      total: 0,
      listLoading: true,
      search: {},
      pagination: {
        'pageNum': 1,
        'pageSize': 20
      },
      options: [{
        value: '10197',
        label: '省政企'
      }, {
        value: '30182',
        label: '哈尔滨市‌'
      }, {
        value: '30183',
        label: '齐齐哈尔市'
      }, {
        value: '30184',
        label: '牡丹江市'
      }, {
        value: '30185',
        label: '佳木斯市'
      }, {
        value: '30186',
        label: '大庆市'
      }, {
        value: '30187',
        label: '伊春市‌'
      }, {
        value: '30188',
        label: '鸡西市‌'
      }, {
        value: '30189',
        label: '鹤岗市‌'
      }, {
        value: '30190',
        label: '双鸭山市'
      }, {
        value: '30191',
        label: '‌七台河市‌'
      }, {
        value: '30192',
        label: '绥化市‌'
      }, {
        value: '30193',
        label: '黑河市‌'
      }, {
        value: '30194',
        label: '大兴安岭'
      }]
    }
  },
  created() {
    query = this.$route.query
    if (query.yearFilter && query.yearFilter != 'all') {
      if (query.yearFilter === String(new Date().getFullYear())) {
        this.search = { ...query, time: [query.yearFilter + '-01-01', moment().format('YYYY-MM-DD')] }
      } else {
        this.search = { ...query, time: [query.yearFilter + '-01-01', query.yearFilter + '-12-31'] }
      }
    } else {
      this.search = { ...query }
    }
    this.getList()
    this.height = this.getHeight()
    const that = this
    window.onresize = function (event) {
      that.height = that.getHeight()
    }
  },
  methods: {
    // base64解密
    base64Decode(base64String) {
      try {
        // 将Base64字符串转换为Uint8Array
        const binaryString = atob(base64String); // 注意：这里使用了atob，但在现代浏览器中，你也可以直接使用Uint8Array的构造函数来处理Base64字符串
        const bytes = new Uint8Array(binaryString.length);
        for (let i = 0; i < binaryString.length; i++) {
          bytes[i] = binaryString.charCodeAt(i);
        }
        // 使用TextDecoder解码Uint8Array到字符串
        const decoder = new TextDecoder();
        return decoder.decode(bytes);
      } catch (error) { }
    },
    getHeight() {
      const winHieght = window.innerHeight
      return winHieght - 240
    },
    getPagination(pagination) {
      this.pagination = pagination
      this.getList()
    },
    onSubmit() {
      this.pagination = {
        'pageNum': 1,
        'pageSize': 20
      }
      this.getList()
    },
    reset() {
      this.pagination = {
        'pageNum': 1,
        'pageSize': 20
      }
      this.search = { ...query }
      this.getList()
    },
    goDetail(row) {
      window.top.postMessage(
        JSON.stringify({
          to: 'portal',
          action: 'open',
          pathname: `/iframe/PROJECT_MENU_MY_PROJECT_PROJECTFULLVIEW?uniqueProjectInstId=${row.UniqueProjectInstId}&bupMenuNo=${row.bupMenuNo}&tableRecord=${row.tableRecord}`
        }),
        '*'
      )
    },
    getList() {
      this.listLoading = true
      try {
        const city = this.options.find(item => item.value == this.search.cityCode)
        const cityName = city?.label || ''
        const param = {
          'condition': {
            'busiOpportunityNumber': this.search.busiOpportunityNumber || '',
            'busiOpportunityCode': this.search.busiOpportunityCode || '',
            'groupProjectCode': this.search.groupProjectCode || '',
            'projectName': this.search.projectName || '',
            cityName,
            'beginPreProjectDate': this.search.time && this.search.time[0] ? this.search.time[0] : '',
            'endPreProjectDate': this.search.time && this.search.time[1] ? this.search.time[1] : ''
          },
          'pageRequest': {
            ...this.pagination
          }
        }
        if (this.search.cityCode) {
          param.cityCode = this.search.cityCode
        } else {
          param.provinceCode = '10008'
        }
        getIncomeQuestion({ param, type: this.search.type }).then(response => {
          this.list = response.list || []
          this.total = response.total || 0
          this.listLoading = false
        })
      } catch (error) {
        console.log('error', error)
        this.listLoading = false
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.page-box {
  background: #fff;
}

::v-deep .el-form-item {
  margin-bottom: 10px;
  margin-right: 20px;
}

::v-deep .el-table th {
  color: #000;
}

::v-deep .el-form-item--medium .el-form-item__content {
  width: 205px;
}

::v-deep .el-form-item--medium .el-form-item__content {
  min-width: 240px;
}

::v-deep .el-date-editor--daterange.el-input__inner {
  width: 240px;
}

::v-deep .el-select {
  width: 100%;
}
</style>
